/*
* Copyright @2009-2012 www.happyelements.com, all rights reserved.
* Create date: 2012-7-27
* Piggy Dong
* 董文弈
* wenyi.dong@happyelements.com
*/
package com.happyelements.isolib
{
	import flash.geom.Point;
	import flash.display.Sprite;

	/**
	 * @author dongpiggyi
	 */
	public class IsoTileSprite extends IsoTileObject
	{
		public function IsoTileSprite(rowIndex:int, columnIndex:int, rows:int = 1, columns:int = 1)
		{
			super(rowIndex, columnIndex, rows, columns);
		}

		override public function set displayObject(displayObject:Object):void
		{
			if (displayObject is Sprite)
			{
				super.displayObject = displayObject;
			}
			else
			{
				throw new Error("displayObject in IsoTileSprite must be Sprite");
			}
		}

		override public function setDisplayObjectPosition(point:Point):void
		{
			getTypedDisplayObject().x = point.x;
			getTypedDisplayObject().y = point.y;
		}

		public function getTypedDisplayObject():Sprite
		{
			return Sprite(displayObject);
		}
	}
}
